package com.goods.controller;

import com.api.admin.AdminRpcService;
import com.common.entity.login.LoginUser;
import com.common.utils.R;
import com.common.utils.auth.SecurityUtils;
import org.apache.dubbo.config.annotation.DubboReference;
import org.springframework.web.bind.annotation.*;

/**
 *
 * 库存 前端控制器
 */
@RestController
@RequestMapping("/goods")
public class GoodsController {


    @DubboReference
    private AdminRpcService adminRpcService;

    /**
     * dubbo远程调用查询订单物流信息
     */
    @GetMapping("getUserName/{userId}")
    public R<String> getOrderAndShipping(@PathVariable(name = "userId") String userId) {
        LoginUser loginUser = SecurityUtils.getLoginUser();
        System.out.println(loginUser.getUsername());
        return adminRpcService.getUserName(userId);
    }

    /**
     * dubbo远程调用查询订单物流信息
     */
    @GetMapping("aaa")
    public R<String> getOrderAndShipping() {
        return R.success("你好啊！order");
    }
}
